package com.cloudptt.api.comm;

import android.content.Context;

import com.cloudptt.api.models.ErrInfo;

public class CauseCont {
	public final static String ERROR_TITLE_SIP = "sip";
	public final static String ERROR_TITLE_COMM = "common";
	public final static String ERROR_TITLE_DETACH = "detach";
	public final static String ERROR_TITLE_CHPWD = "chpwd";
	public final static String ERROR_TITLE_LOG = "log";

	public static final int SipErrCode_Begin = 300;
	public static final int SipErrCode_Init_606 = 606;
	public static final int SipErrCode_Init_486 = 486;
	
	public static final int OperateCheck_Suc = 0;
	public static final int ERROR_SYS_BEGIN = 100;
	public static final int OperateCheck_Sys_AccountNull = (ERROR_SYS_BEGIN+1);
	public static final int OperateCheck_Sys_ServiceNull = (ERROR_SYS_BEGIN+2);
	public static final int OperateCheck_Sys_AccountNumNull = (ERROR_SYS_BEGIN+3);
	public static final int OperateCheck_Sys_OperateException = (ERROR_SYS_BEGIN+4);
	public static final int OperateCheck_Sys_LinkDisconnect = (ERROR_SYS_BEGIN+5);
	public static final int OperateCheck_Sys_UserKeyNull = (ERROR_SYS_BEGIN+6);
	public static final int OperateCheck_Sys_UnLogin = (ERROR_SYS_BEGIN+7);
	public static final int OperateCheck_Sys_InLogining = (ERROR_SYS_BEGIN+8);
	public static final int OperateCheck_Sys_SvrStart = (ERROR_SYS_BEGIN+9);
	public static final int OperateCheck_Sys_SvrStop = (ERROR_SYS_BEGIN+10);
	public static final int OperateErr_SIP = (ERROR_SYS_BEGIN+11);
	public static final int OperateErr_Update = (ERROR_SYS_BEGIN+12);
	public static final int OperateErr_Exception = (ERROR_SYS_BEGIN+13);
	public static final int OperateErr_GroupNull = (ERROR_SYS_BEGIN+14);
	public static final int OperateErr_NoAgent = (ERROR_SYS_BEGIN+15);
	public static final int OperateErr_NoAuthorize_Ptt = (ERROR_SYS_BEGIN+16);
	public static final int OperateErr_NoAuthorize_Video = (ERROR_SYS_BEGIN+17);
	public static final int OperateErr_NoAuthorize_Data = (ERROR_SYS_BEGIN+18);
	public static final int OperateErr_CallNull = (ERROR_SYS_BEGIN+19);
	public static final int OperateErr_OpQuick = (ERROR_SYS_BEGIN+20);
	public static final int OperateErr_Offline = (ERROR_SYS_BEGIN+21);
	public static final int OperateErr_RightOccupy = (ERROR_SYS_BEGIN+22);
	public static final int OperateErr_Invalid = (ERROR_SYS_BEGIN+23);
	public static final int OperateErr_DataNull = (ERROR_SYS_BEGIN+24);
	public static final int OperateErr_Stack = (ERROR_SYS_BEGIN+25);
	
	public static final int Cause_loginOtherside = 0;
	public static final int Cause_SystemKill = 1;
	public static final int Cause_Default = Cause_SystemKill;
	
	public static final int ERROR_CALL_BEGIN = 200;
	public static final int OperateCheck_Call_NumNull = (ERROR_CALL_BEGIN+1);
	public static final int OperateCheck_Call_CallMySelf = (ERROR_CALL_BEGIN+2);
	public static final int OperateCheck_Call_CallExist = (ERROR_CALL_BEGIN+3);
	public static final int OperateCheck_Call_CallNoExist = (ERROR_CALL_BEGIN+4);
	public static final int OperateCheck_Call_CallTooMany = (ERROR_CALL_BEGIN+5);
	public static final int OperateCheck_Call_CallTypeErr = (ERROR_CALL_BEGIN+6);
	
	
	public static String getForceDetachCauseStr(int causeCode, Context context)
	{
		String causeStr = "";
		ErrInfo errInfo = new ErrInfo(ERROR_TITLE_DETACH, causeCode);
		if(errInfo != null )
		{
			causeStr = errInfo.getErrDesc();
		}
		return causeStr;
	}
	
	public static String getOperateCheckErrStr(int causeCode, Context context)
	{
//		int voiceErrType = SoundManage.VoiceErrType_Disconnect;
//		if(causeCode == OperateErr_Update)
//		{
//			voiceErrType = SoundManage.VoiceErrType_Update;
//		}
//		//播放声音
//		new SoundManage(context).playVoiceWarring(voiceErrType);
		
		String causeStr = "";
		ErrInfo errInfo = new ErrInfo(ERROR_TITLE_COMM, causeCode);
		if(errInfo != null )
		{
			causeStr = errInfo.getErrDesc();
		}
		return causeStr;
	}
}
